<!DOCTYPE html>
<html>
<head>
	<title>注册</title>
	<meta content="text/html" charset="utf8">
</head>
<body>
	<div id="d1"></div>
	<table border="1px">
		<tr>
			<td>用户名：</td>
			<td><input type="text" name="email" id="email"></td>
			<td width="200px"><div id="div_email"></div></td>
		</tr>
		<tr>
			<td>密码：</td>
			<td><input type="text" name="password" id="password"></td>
			<td><div id="div_password"></div></td>
		</tr>
		<tr>
			<td>确认密码：</td>
			<td><input type="text" name="confirm_password" id="confirm_password"></td>
			<td><div id="div_confirm_password"></div></td>
		</tr>
		<tr>
			<td>姓氏：</td>
			<td><input type="text" name="surname" id="surname"></td>
			<td><div id="div_surname"></div></td>
		</tr>
		<tr>
			<td>名称：</td>
			<td><input type="text" name="given_name" id="given_name"></td>
			<td><div id="div_given_name"></div></td>
		</tr>
		<tr>
			<td>电话：</td>
			<td><input type="text" name="phone" id="phone"></td>
			<td><div id="div_phone"></div></td>
		</tr>
		<tr>
			<td>职位：</td>
			<td><input type="text" name="title" id="title"></td>
			<td><div id="div_title"></div></td>
		</tr>
		<tr>
			<td>公司名称：</td>
			<td><input type="text" name="company_name" id="company_name"></td>
			<td><div id="div_company_name"></div></td>
		</tr>
		<tr>
			<td>公司地址：</td>
			<td><input type="text" name="address" id="address"></td>
			<td><div id="div_address"></div></td>
		</tr>
		<tr>
			<td>部门：</td>
			<td><input type="text" name="departmen" id="departmen"></td>
			<td><div id="div_departmen"></div></td>
		</tr>
		<tr>
			<td>邮编：</td>
			<td><input type="text" name="zip_code" id="zip_code"></td>
			<td><div id="div_zip_code"></div></td>
		</tr>
		<tr>
			<td>城市：</td>
			<td><input type="text" name="city" id="city"></td>
			<td><div id="div_city"></div></td>
		</tr>
		<tr>
			<td>注册序列号：</td>
			<td><input type="text" name="register_number" id="register_number"></td>
			<td><div id="div_register_number"></div></td>
		</tr>
		<tr>
			<td>角色：</td>
			<td><select name="role_id" id="role_id">
					<option></option>
				@foreach($roles as $value)
					<option value="{{$value['role_id']}}">{{$value['role_name']}}</option>
				@endforeach
				</select>
			</td>
			<td><div id="div_role_id"></div></td>
		</tr>
		<tr>
			<td></td>
			<td><input type="button" name="register" id="register" value="注册"><input type="button" name="cancel" id="cancel" value="取消"></td>
		</tr>
	</table>

<script type="text/javascript" src="/js/jquery-1.11.3.js"></script>
<script type="text/javascript">
$(function(){
	$("#register").click(function(){
		data={
			email: $("#email").val(),
			password: $("#password").val(),
			confirm_password: $("#confirm_password").val(),
			surname: $("#surname").val(),
			given_name: $("#given_name").val(),
			phone: $("#phone").val(),
			title: $("#title").val(),
			company_name: $("#company_name").val(),
			address: $("#address").val(),
			departmen: $("#departmen").val(),
			zip_code: $("#zip_code").val(),
			city: $("#city").val(),
			register_number: $("#register_number").val(),
			role_id: $("#role_id").val()
		};
		$.post("Register", data, function(data){
			if(data.status.Code==0)
			{
				alert('success');
			}
			else
			{
				$('#d1').html(data.status.message);
			}

		})
	});
});
</script>
</body>
</html>